<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/WEB-INF/views/wx/include/head.jsp" %>
<style>
.mui-content{position:relative;}
.wait{font-size:48px;text-weight:bold;color:#9E9E9E;position:absolute;top:11px;left:11px;text-shadow: 1px 1px 2px black;}
</style>
</head>
<body>
	<div class="mui-content">
		<span class="wait">等待支付</span>
	</div>
	<c:set var="messageFix" value="yes"/>
	<%@ include file="/WEB-INF/views/wx/include/script.jsp"%>
	<script>
		var height = ((document.body.offsetHeight-48)/2);
		var width = (document.body.offsetWidth/2-48*2);
		$('.wait').css('top',(height+2)+'px');
		$('.wait').css('left',(width+2)+'px');
		$('.wait-bg').css('top',height+'px');
		$('.wait-bg').css('left',width+'px');
		
		function onBridgeReady() {
			WeixinJSBridge.invoke('getBrandWCPayRequest', {
				"appId" : "${appId}",
				"timeStamp" : "${timeStamp}",
				"nonceStr" : "${nonceStr}",
				"package" : "${prepay_id}",
				"signType" : "${signType}",
				"paySign" : "${signature}"
			}, function(res) {
				if (res.err_msg == "get_brand_wcpay_request:ok") {
					/* mui.alert('支付成功', '支付结果', function() {
						window.location.href = '${ctxWx}/pu/orders/orderList';
					}); */
					//$.post('${ctxWx}/pu/orders/comfirmPay?orderid=${orders.orderid }&transaction_id=${timeStamp}&dueamount=${orders.dueamount }')
					window.location.href = '${ctxWx}/orders/orderList';
				} else {
					window.location.href = '${ctxWx}/orders/orderList';
				}
			});
		}
		if (typeof WeixinJSBridge == "undefined") {
			if (document.addEventListener) {
				document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
			} else if (document.attachEvent) {
				document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
				document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
			}
		} else {
			onBridgeReady();
		}
	</script>
</body>
</html>